//
//  EFOrderPayMoneyDetailCell.m
//  EnjogFood
//
//  Created by 王芳 on 17/5/13.
//  Copyright © 2017年 wf. All rights reserved.
//

#import "EFOrderPayMoneyDetailCell.h"
#import "EFOrderPayTypeItem.h"

@interface EFOrderPayMoneyDetailCell ()
@property (strong, nonatomic) UIView *lineView;

@property (strong, nonatomic) UILabel *payTipLabel;
@property (strong, nonatomic) UILabel *payTypeLabel;

@property (strong, nonatomic) UIView *line1;


@end

@implementation EFOrderPayMoneyDetailCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

- (void)initUI{
    [self.contentView addSubview:self.payTipLabel];
    self.payTipLabel.left = 20;
    self.payTipLabel.top = 19;
    
    [self.contentView addSubview:self.payTypeLabel];
    self.payTipLabel.top = self.payTipLabel.top;
    
    [self.contentView addSubview:self.line1];
   
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.line1.left = self.payTipLabel.left;
    self.line1.top = self.payTipLabel.bottom + 12;
}

- (void)setObject:(EFOrderPayTypeItem *)payType{
    self.payTypeLabel.text = payType.payType;
    [self.payTypeLabel sizeToFit];
    
    self.payTypeLabel.right = kScreenWidth - 20;
    self.payTypeLabel.top = self.payTipLabel.top;
}

- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
        _lineView.backgroundColor = RGBCOLOR(0xf4f4f4);
    }
    return _lineView;
}

- (UILabel *)payTipLabel{
    if (!_payTipLabel) {
        _payTipLabel = [[UILabel alloc] init];
        _payTipLabel.font = [UIFont systemFontOfSize:13];
        _payTipLabel.textColor = kBlack999;
        _payTipLabel.text = @"支付方式：";
        [_payTipLabel sizeToFit];
    }
    return _payTipLabel;
}

- (UILabel *)payTypeLabel{
    if (!_payTypeLabel) {
        _payTypeLabel = [[UILabel alloc] init];
        _payTypeLabel.font = [UIFont systemFontOfSize:13];
        _payTypeLabel.textColor = kBlack333;
    }
    return _payTypeLabel;
}

- (UIView *)line1{
    if (!_line1) {
        _line1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 2*20, 1)];
        _line1.backgroundColor = RGBCOLOR(0xececec);
    }
    return _line1;
}


@end
